import { createRouter, createWebHashHistory } from 'vue-router'


const routes = [
  {
    path: '/',
    name: 'home',
    redirect: '/home',
    component: () => import('@/views/HomePage'),
    meta: {
      title: '小米Demo'
    },
    children: [
      {
        path: 'home',
        name: '_home',
        component: () => import('@/views/main-page/MainPage'),
      },
      {
        path: 'category',
        name: 'category',
        component: () => import('@/views/category/CategoryPage'),
        meta: {
          title: '分类'
        }
      },
      //用户主页
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/user/UserHome'),
        meta: {
          title: '用户中心'
        }

      },
      //米圈
      { 
        path: 'mi-blog',
        name: 'mi_blog',
        component: () => import('@/views/mi-blog/MiBlogPage'),
      },
      //搜索列表页
      {
        path: '/search/list',
        name: 'search_list',
        component: () => import('@/views/search/SearchList'),
        meta: {
          title: '搜索结果'
        }
      },
      {
        path:'/cart',
        name:'cart',
        component:()=>import ('../views/product/index.vue'),
        meta: { 
          showTarbar:true
         }
      }

    ]
  },
   // 朋友圈列表详情
   {
    path:'/Details/:id?',
    name:'Details',
    component:()=>import('@/views/mi-blog/components/CharacterTheoryDetails')
  },
  {
    path:'/user/login/:id?',
    name:'user_login',
    component:()=>import('@/views/user-login/UserLogin')
  },
  // 商品详情
  {
    path: '/cartCategroy/:id',
    name: 'cartCategroy',
    component: () => import('@/views/cartCategroy'),
    meta: {
      title: '商品详情',
      showTarbar:true
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
